<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 
        输入某个数字，计算数字的阶乘
        6!=1*2*3*4*5*6
     -->
    <script>
      
      function text(n) {
        if (n == 1) {
          return n;
        } else {
          return n * text(n - 1);
        }
      }
      console.log("6!的结果是:", text(6));
    </script>
  </body>
</html>
